const Mock = require('mockjs')
// 项目信息
const iteme = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        name: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //项目名称
        unit: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //项目单位
        contact_person: () => Mock.Random.string('0123456789', 12),    //联系人
        households: '@string("number", 3)',   //项目户数
    }]
});
// 建筑信息
const unit = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        name: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //建筑名称
        age: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //建筑年代
        feature:() => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },  //建筑功能
        area: '@string("number", 3)',   //建筑面积
    }]
});

// 房屋信息
const house = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        name: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //建筑名称
        position: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //位置
        use:() => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },  //房屋用途
        area: '@string("number", 3)',   //面积
        account: '@string("number", 3)',   //业主户号
    }]
});
// 设备信息
const manage = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        type: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备类型
        address: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //名称
        name:() => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },  //位置
        position:() => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        }, 
    }]
});
// 仪表设备
const appearance = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        type: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备类型
        address: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //名称
        name:() => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },  //位置
        position:() => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        }, 
    }]
});
// 设备信息
const facility = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        type: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备类型
        autonomously: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //自主命名
        name: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备名称
        equipment:() => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },  //设备地址
        control:() => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },   //中控地址
        quantity: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //从机数量
        protocolPackage: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //协议包
        port:() => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },  //端口号
        ip:() => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        }, //IP地址
        time:() => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },  //超时时间
        communicate:() => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        }, //通讯地址
    }]
});
// cplc
const cplc = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        name: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备类型
        model: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //名称
        address:() => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },  //位置
        ip:() => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        }, 
        Ai:() => Mock.Random.integer(1, 9),
        Ao:() => Mock.Random.integer(1, 9),
        Di:() => Mock.Random.integer(1, 9),
        Do:() => Mock.Random.integer(1, 9),
    }]
});
// caio
const caio = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        name: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //CAIO名称
        address: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //CAIO地址
        type:() => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },  //CAIO类型
        sort:() => Mock.Random.integer(1e11, 1e12 - 1),  //设备排序
        Ai:() => Mock.Random.integer(1, 9),  //Ai数量
        Ao:() => Mock.Random.integer(1, 9),   //Ao数量
    }]
});
// cdio
const cdio = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        name: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //CDIO名称
        address: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //CDIO地址
        type:() => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },  //CDIO类型
        sort:() => Mock.Random.integer(1e11, 1e12 - 1),  //设备排序
        Ai:() => Mock.Random.integer(1, 9),  //Di数量
        Ao:() => Mock.Random.integer(1, 9),   //DO数量
    }]
});
// port
const port = Mock.mock({
    'items|30': [{
        index: '@increment',   //序号
        equipment_type: () => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //设备类型
        control_type: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //名称
        control_name:() => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },  //位置
        port_type:() => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        }, 
        port_number: () => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },     //名称
        data_name:() => {
            const randomLength = Mock.Random.integer(8, 10);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        },  //位置
        register:() => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        }, 
        register_address:() => {
            const randomLength = Mock.Random.integer(2, 3);
            let chineseCharacters = '';
            for (let i = 0; i < randomLength; i++) {
                chineseCharacters += String.fromCharCode(Mock.Random.integer(0x4e00, 0x9fa5));
            }
            return chineseCharacters;
        }, 
    }]
});



module.exports = [
    // 项目信息
    {
        url: '/vue-admin-template/iteme/iteme',
        type: 'get',
        response: config => {
            const items = iteme.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 建筑信息
    {
        url: '/vue-admin-template/unit/unit',
        type: 'get',
        response: config => {
            const items = unit.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 房屋信息
    {
        url: '/vue-admin-template/house/house',
        type: 'get',
        response: config => {
            const items = house.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 设备信息
    {
        url: '/vue-admin-template/manage/manage',
        type: 'get',
        response: config => {
            const items = manage.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 仪表设备
    {
        url: '/vue-admin-template/appearance/appearance',
        type: 'get',
        response: config => {
            const items = appearance.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // 设备信息
    {
        url: '/vue-admin-template/facility/facility',
        type: 'get',
        response: config => {
            const items = facility.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // cplc
    {
        url: '/vue-admin-template/cplc/cplc',
        type: 'get',
        response: config => {
            const items = cplc.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // caio
    {
        url: '/vue-admin-template/caio/caio',
        type: 'get',
        response: config => {
            const items = caio.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // cdio
    {
        url: '/vue-admin-template/cdio/cdio',
        type: 'get',
        response: config => {
            const items = cdio.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
    // port
    {
        url: '/vue-admin-template/port/port',
        type: 'get',
        response: config => {
            const items = port.items
            return {
                code: 20000,
                data: {
                    total: items.length,
                    items: items
                }
            }
        }
    },
]